<?php
class DataBase {
    private $type = "localhost";
    private $user = "root";
    private $pass = "";
    private $name_db = "new_htbet";
    private $link;
    //Подключение к БД
    private function connect(){
        $this->link = mysql_connect($this->type, $this->user, $this->pass);
        mysql_select_db($this->name_db);
        mysql_query('SET NAMES "utf8"');
    }
    //Закрытие базы данных
    private function close(){
    	mysql_close($this->link);
    }
    //Получения существования пользователя.
    public function GetUser($login){
    	$this->connect();
    	$result = mysql_query("SELECT `nick` FROM `users` WHERE `nick` = '$login'");
    	$num = mysql_num_rows($result);
    	if($num==1){
    		return true;
    	}else{
    		return false;
    	}    	
    	$this->close();
    }
}
?>